import {
  BasicColumn
} from '/@/components/Table';
import {
  FormSchema
} from '/@/components/Table';
import {
  rules
} from '/@/utils/helper/validator';
import {
  render
} from '/@/utils/common/renderUtils';
import {
  JVxeTypes,
  JVxeColumn
} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '订单类型',
  //   align: "center",
  //   dataIndex: ''
  // },
  {
    title: '订单渠道',
    align: "center",
    dataIndex: 'channel'
  },
  {
    title: '订单编号',
    align: "center",
    dataIndex: 'orderNumber'
  },
  // {
  //   title: '行号',
  //   align: "center",
  //   dataIndex: ''
  // },
  {
    title: '产品编码',
    align: "center",
    dataIndex: 'productCode'
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  // {
  //   title: '产品规格',
  //   align: "center",
  //   dataIndex: ''
  // },
  // {
  //   title: '单位',
  //   align: "center",
  //   dataIndex: ''
  // },
  {
    title: '订单数量',
    align: "center",
    dataIndex: 'quantity'
  },
  {
    title: '订单交期',
    align: "center",
    dataIndex: 'deliveryDate',
    customRender: ({
      text
    }) => {
      return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
    },
  },
  // {
  //   title: '业务员',
  //   align: "center",
  //   dataIndex: ''
  // },
  // {
  //   title: '生产组织',
  //   align: "center",
  //   dataIndex: ''
  // },
];
//查询数据 
export const searchFormSchema: FormSchema[] = [{
  label: "MPS编码",
  field: 'mpsCode',
  component: 'Input',
  slot: 'form-billType',
  colProps: {
    span: 6
  },
},
  // {
  //   label: "排产名称",
  //   field: 'pcName',
  //   component: 'Input',
  //   colProps: {
  //     span: 6
  //   },
  // },
  // {
  //   label: "版本号",
  //   field: 'bbCode',
  //   component: 'Input',
  //   colProps: {
  //     span: 6
  //   },
  // },
];
//表单数据
export const formSchema: FormSchema[] = [{
  label: '单据类型',
  field: 'billTypeName',
  component: 'Input',
},
// {
//   label: '来源类型',
//   field: 'srcBillType',
//   component: 'Input',
// },
// {
//   label: '来源单据编号',
//   field: 'srcBillCode',
//   component: 'Input',
// },
// {
//   label: '来源行号',
//   field: 'srcRowNumber',
//   component: 'InputNumber',
// },
// {
//   label: '源头单据编号',
//   field: 'firstBillCode',
//   component: 'Input',
// },
// {
//   label: '源头单据类型',
//   field: 'firstBillTypeName',
//   component: 'Input',
// },
{
  label: '订单类型', //1国内订单 2国外订单 3研发订单 4配件订单
  field: 'orderType',
  component: 'Select',
  defaultValue: 1,
  componentProps: {
    options: [{
      label: '国内订单',
      value: 1
    }, {
      label: '国外订单',
      value: 2
    }, {
      label: '研发订单',
      value: 3
    }, {
      label: '配件订单',
      value: 4
    }],
    stringToNumber: true,
  }
},
{
  label: '订单渠道', // 1直销订单 2分销订单
  field: 'orderChannel',
  component: 'Select',
  componentProps: {
    options: [{
      label: '国内订单',
      value: 0
    }, {
      label: '海外订单',
      value: 1
    }, {
      label: '研发订单',
      value: 2
    }, {
      label: '售后订单',
      value: 3
    }],
    stringToNumber: true,
  }
},
{
  label: '订单编码',
  field: 'orderCode',
  component: 'Input',
},
{
  label: '行号',
  field: 'lineNumber',
  component: 'Input',
},
{
  label: '产品编码',
  field: 'productCode',
  component: 'Input',
  slot: 'productNameSlot'
},
{
  label: '产品名称',
  field: 'productName',
  component: 'Input',
},
{
  label: '产品规格',
  field: 'productStandard',
  component: 'Input',
},
{
  label: '单位',
  field: 'unit',
  component: 'Input',
},
{
  label: '订单数量',
  field: 'orderQuantity',
  component: 'InputNumber',
},
{
  label: '订单交期',
  field: 'orderDeliveryTime',
  component: 'DatePicker',
},
{
  label: '生产组织',
  field: 'productionOrganization',
  component: 'Input',
},
{
  label: '第三方编码',
  field: 'thirdPartyCode',
  component: 'Input',
  ifShow: false
},
{
  label: '备注',
  field: 'remark',
  component: 'Input',
},
// TODO 主键隐藏字段，目前写死为ID
{
  label: '',
  field: 'id',
  component: 'Input',
  show: false
},
];
//子表单数据
//子表表格配置
export const psProductionTrackingEstateColumns: JVxeColumn[] = [{
  title: '第三方编码',
  key: 'thirdPartyCode',
  type: JVxeTypes.hidden,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '备注',
  key: 'remark',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '单据类型',
  key: 'billTypeName',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
// {
//   title: '来源类型',
//   key: 'srcBillType',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '来源单据编号',
//   key: 'srcBillCode',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '来源行号',
//   key: 'srcRowNumber',
//   type: JVxeTypes.inputNumber,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '源头单据编号',
//   key: 'firstBillCode',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '源头单据类型',
//   key: 'firstBillTypeName',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
{
  title: '订单编号',
  key: 'orderReference',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '产品编号',
  key: 'identificationProduct',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '产品名称',
  key: 'productName',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '工单编码',
  key: 'workOrderCoding',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '组件编码',
  key: 'componentCoding',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '组件名称',
  key: 'componentName',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '计划开工',
  key: 'projectStart',
  type: JVxeTypes.date,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '实际开工',
  key: 'actualCommencement',
  type: JVxeTypes.date,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '延期',
  key: 'postpone',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '需求数量',
  key: 'quantityRequired',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '完工数量',
  key: 'quantityCompleted',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '报废数量',
  key: 'scrapQuantity',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '齐套日期',
  key: 'setTime',
  type: JVxeTypes.date,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '齐套标志', //0 否  1 是
  key: 'setMark',
  type: JVxeTypes.select,
  width: "200px",
  placeholder: '请选择${title}',
  defaultValue: 0,
  options: [{ value: 0, label: '否' }, { value: 1, label: '是' }]
},
{
  title: '状态', // 1生产中 2待开工
  key: 'state',
  type: JVxeTypes.select,
  width: "200px",
  placeholder: '请选择${title}',
  defaultValue: 1,
  options: [{ value: 1, label: '生产中' }, { value: 2, label: '待开工' }]
},
]
export const psProductionTrackingPurchasingStatusColumns: JVxeColumn[] = [{
  title: '第三方编码',
  key: 'thirdPartyCode',
  type: JVxeTypes.hidden,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '备注',
  key: 'remark',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '单据类型',
  key: 'billTypeName',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
// {
//   title: '来源类型',
//   key: 'srcBillType',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '来源单据编号',
//   key: 'srcBillCode',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '来源行号',
//   key: 'srcRowNumber',
//   type: JVxeTypes.inputNumber,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '源头单据编号',
//   key: 'firstBillCode',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
// {
//   title: '源头单据类型',
//   key: 'firstBillTypeName',
//   type: JVxeTypes.input,
//   width:"200px",
//   placeholder: '请输入${title}',
//   defaultValue:'',
// },
{
  title: '计划编号',
  key: 'planNumber',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '请购单编号',
  key: 'purchaseRequisitionNumber',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '供应类型', // 1委外 2采购
  key: 'typeSupply',
  type: JVxeTypes.select,
  width: "200px",
  placeholder: '请选择${title}',
  defaultValue: 1,
  options: [{ value: 1, label: '委外' }, { value: 2, label: '采购' }]
},
{
  title: '料号',
  key: 'objectId',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '产品名称',
  key: 'productName',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '请购数量',
  key: 'requisitionedQuantity',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '采购数量',
  key: 'purchaseAmount',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '库存数量',
  key: 'quantityStock',
  type: JVxeTypes.inputNumber,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '采购交期',
  key: 'purchaseDeliveryTime',
  type: JVxeTypes.date,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
{
  title: '齐套标记',
  key: 'setMark',
  type: JVxeTypes.select,
  width: "200px",
  placeholder: '请选择${title}',
  defaultValue: 0,
  options: [{ value: 0, label: '否' }, { value: 1, label: '是' }]
},
{
  title: '单据编码',
  key: 'documentCoding',
  type: JVxeTypes.input,
  width: "200px",
  placeholder: '请输入${title}',
  defaultValue: '',
},
]


/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
